package com.hospital.pet.love.lovepethospital.config;

import io.swagger.v3.oas.models.OpenAPI;
import io.swagger.v3.oas.models.info.Contact;
import io.swagger.v3.oas.models.info.Info;
import org.springdoc.core.models.GroupedOpenApi;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;

/**
 * @author RoselleShaw
 * @create 2024-04-07 15:08
 */
@Configuration
public class Knife4jConfig {

    @Bean
    public GroupedOpenApi authApi() {
        return GroupedOpenApi.builder()
                .group("用户模块")
                .pathsToMatch("/user/**")
                .build();
    }

    @Bean
    public GroupedOpenApi customerApi() {
        return GroupedOpenApi.builder()
                .group("客户模块")
                .pathsToMatch("/pet-info/**")
                .build();
    }

    @Bean
    public GroupedOpenApi employeeApi() {
        return GroupedOpenApi.builder()
                .group("员工模块")
                .pathsToMatch("/employee/**")
                .build();
    }

    @Bean
    public GroupedOpenApi registerApi() {
        return GroupedOpenApi.builder()
                .group("挂号、病例模块")
                .pathsToMatch("/register/**","/case/**")
                .build();
    }

    @Bean
    public GroupedOpenApi drugApi() {
        return GroupedOpenApi.builder()
                .group("药品模块")
                .pathsToMatch("/drug/**")
                .build();
    }

    /**
     * 自定义接口文档的基本信息
     */
    @Bean
    public OpenAPI customOpenAPI() {
        return new OpenAPI()
                .info(new Info()
                        .title("爱心宠物医院接口文档")
                        .version("1.0")
                        .description("爱心宠物医院接口文档")
                        .contact(new Contact().name("shaw")));
    }

}
